/* loc_stat.c -- 使用局部静态变量 */
#include <stdio.h>
void trystat(void);
void trystat2(void);

int main(void) {
  int count;
  for (count = 1; count <= 3; count++) {
    printf("Here comes iteration %d:\n", count);
    trystat();
  }
  for (count = 1; count <= 3; count++) {
    printf("Here comes iteration %d:\n", count);
    trystat2();
  }
  return 0;
}

void trystat(void) {
  int fade = 1;
  static int stay = 1;
  printf("fade = %d and stay = %d\n", fade++, stay++);
}

void trystat2(void) {
  int fade = 1;
  static int stay = 10;
  printf("fade = %d and stay = %d\n", fade++, stay++);
}